<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <link rel="shortcut icon" href="../../src/images/bitbug_favicon.ico" type="image/x-icon">
  <meta name="keywords" content="your keywords">
  <meta name="description" content="your description">
  <meta name="author" content="author,email address">
  <meta name="robots" content="index,follow">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <title>仁和区党群服务一号通暨群众意见受理中心</title>
  <link rel="stylesheet" href="../../src/css/base.css">
  <link rel="stylesheet" href="../../src/css/common.css">
  <link rel="stylesheet" href="../../src/css/tpl.css">
  <link rel="stylesheet" href="../../src/css/user_center.css">
    <script src="../../src/js/libs/es5-shim.min.js"></script>   <script src="../../src/js/libs/es5-sham.min.js"></script>    <script src="../../src/js/libs/json3.min.js"></script> </head>

<body>
  <div class="page">
    <div id="header">
    </div>
    <div class="menu-bar">
      <div class="container">
        <span>
        <span class="crumb-name">当前你的位置：</span>>
        </span>
        <span>
             <a href="../Home/Index.html">首页</a>>
      </span>
        <span>个人中心</span>
      </div>
    </div>

    <div class="mid_container clearfix">
      <div class="left_guide">
        <h1 class="left_guide_top_size">
          个人中心
        </h1>
        <div class="left_guide_decorate">
        </div>
        <div class="left_about_us">
          ABOUT US
        </div>
        <div class="left_white_about ">
          <a href="../Personal/LeaveMessage.html">
            <span class="left_cn_about_us">系统消息</span>
          </a>
        </div>
        <div class="left_white_about active">
          <a href="../Personal/Collect.html">
            <span class="left_cn_about_us">我的收藏</span>
          </a>
        </div>
        <div class="left_white_about">
          <a href="../Personal/Work.html">
            <span class="left_cn_about_us">我的工作</span>
          </a>
        </div>
        <div class="left_white_about">
          <a href="../Personal/set.html">
            <span class="left_cn_about_us">修改密码</span>
          </a>
        </div>
      </div>
      <div class="mid_guide">
        <div class="mid_guide_content tabs">
          <div class="title">
            <div class="tab-item">
              <ul id="title_html">
                <li class="active" typeid="0">全部</li>
              </ul>
            </div>
          </div>
          <div class="content" style="padding:20px" id="list_html">
          </div>

          <div id="page1" class="laypage"></div>
        </div>
      </div>
    </div>
  </div>
  <div id="footer"></div>
  <script type="text/html" id="title_tpl">
    {{each datalist val idx}}
    <li class="fof" typeid="{{val.id}}">{{val.typename}}</li>
    {{/each}}
  </script>
  <script type="text/html" id="list_tpl">
    {{each resultdata val idx}}
    <div class="news_item">
      <a href="../News/Detail.html?id={{val.id}}">
        <div class="news_item_all">
          <img src="http://221.10.2.222:5680/api/v1/Files?filename={{val.contenturls}}" class="news_item_img">
          <div class="news_item_passage">
            <div class="news_item_passage_title">{{val.title}}</div>
            <span>{{val.content}}</span>
            <div class="news_item_passage_time">{{val.origin}} {{val.publishtime}}</div>
          </div>
        </div>
      </a>
    </div>
    {{/each}} {{if resultdata.length === 0}}
    <div class="empty_box">
      <img src="../../src/images/null_state.png" alt="">
    </div>
    {{/if}}
  </script>
  <script src="../../src/js/libs/jquery.1.12.4.js"></script>
  <script src="../../src/js/libs/template-web.js"></script>
  <script src="../../src/js/libs/laypage/laypage.js"></script>
  <script src="../../src/js/base/common.js"></script>
  <script>
    var params = {
      type: 0,
      userid: document.cookie.split(";")[1].split("=")[1],
      page: 1
    }

    var pageindex = 6

    $(document).on('click', '.tab-item li', function (res) {
      if ($(this).hasClass('active')) return
      params.type = $(this).attr('typeid')
      $(this).addClass('active').siblings().removeClass('active')
      getList(params, params.page)
    })

    getList(params, params.page)

    $.ajax({
      url: 'http://221.10.2.222:5680/api/ow/NewsType/TypeList',
      type: "GET",
      dataType: "json",
      success: function (res) {
        var data = {
          datalist: res
        }
        var title = template('title_tpl', data)
        $('#title_html').append(title)
      }
    })

    function getList(params, page) {
      $.ajax({
        url: 'http://221.10.2.222:5680/api/ow/news/listByUserId',
        type: "GET",
        dataType: "json",
        data: {
          "type": params.type,
          "userid": params.userid,
          "page": page
        },
        success: function (res) {
          res.resultdata = JSON.parse(res.resultdata)
          res.count = parseInt(res.count)
          console.log(res)
          var list = template('list_tpl', res)
          $('#list_html').html(list)
          laypage({
            cont: 'page1',
            pages: Math.ceil(res.count / 5), //通过后台拿到的总页数
            curr: 1, //当前页
            first: false,
            last: false,
            prev: '<',
            next: '>',
            jump: function (obj, first) {
              if (!first) {
                getList(params, obj.curr);
              }
            }
          });
        }
      })
    }
  </script>
</body>

</html>